package com.vogue.family.data.api;

import com.vogue.family.data.entity.AccessToken;
import com.vogue.family.data.entity.BaseResponse;
import com.vogue.family.data.entity.Meeting;
import com.vogue.family.data.entity.User;

import java.util.HashMap;
import java.util.List;

import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;

public interface MeetingApiService {

    String BASE_URL="";

    /**
     * 注册
     * @return
     */
    @POST("/user/signUp")
    @Headers({ "Content-Type: application/json;charset=UTF-8"})
    Observable<BaseResponse<User>> signUp(@Body HashMap<String,String> map);

    /**
     * AccessToken 获取与更新
     * @param map
     * @return
     */
    @POST("/api/oauth/token")
    @Headers({ "Content-Type: application/json;charset=UTF-8;"})
    Observable<BaseResponse<AccessToken>> signIn(@Body HashMap<String,String> map);

    /**
     * 检查token
     * @return
     */
    @POST("/api/oauth/check")
    @Headers({ "Content-Type: application/json;charset=UTF-8"})
    Observable<BaseResponse<User>> checkToken();

    /**
     * 用户信息
     * @return
     */
    @POST("/user/info")
    @Headers({ "Content-Type: application/json;charset=UTF-8"})
    Observable<BaseResponse<User>> userInfo();

    /**
     * 创建会议
     * @return
     */
    @POST("/meeting/create")
    @Headers({ "Content-Type: application/json;charset=UTF-8"})
    Observable<BaseResponse<Meeting>> createMeeting(@Body Meeting meeting);

    /**
     * 进入会议(待实现，结合jitsi，未知可行否)
     * @return
     */
    @POST("/meeting/enter")
    @Headers({ "Content-Type: application/json;charset=UTF-8"})
    Observable<BaseResponse<Meeting>> enterMeeting(@Query("meetingCode") String meetingCode);

    /**
     * 离开会议(待实现，结合jitsi，未知可行否)
     * @return
     */
    @POST("/meeting/leave")
    @Headers({ "Content-Type: application/json;charset=UTF-8"})
    Observable<BaseResponse<Meeting>> leaveMeeting(@Query("meetingCode") String meetingCode);

    /**
     * 会议
     * @return
     */
    @POST("/meeting/list")
    @Headers({ "Content-Type: application/json;charset=UTF-8"})
    Observable<BaseResponse<List<Meeting>>> getMeeting(@Query("page") Integer page);


}
